From: Jonas Ã…dahl Date: Tue, 21 Apr 2020 14:13:20 +0000 (+0200) Subject: js/main: Inhibit remote access when depending on session mode X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~684^2^2~458 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=c3646a7642fea6764a5e7f9c6a70e6a8e33a4287;p=gnome-shell.git js/main: Inhibit remote access when depending on session mode The session mode determines whether the screen casting should work or not, but until now only dealt with the built in screen cast, not the ones using PipeWire. Add the newly added API for inhibiting remote access when the session mode says screencasts are not allowed. https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1210 --- diff --git a/js/ui/main.js b/js/ui/main.js index bdd93ae1b..2d7a48019 100644 --- a/js/ui/main.js +++ b/js/ui/main.js @@ -97,6 +97,8 @@ let _oskResource = null; Gio._promisify(Gio._LocalFilePrototype, 'delete_async', 'delete_finish'); Gio._promisify(Gio._LocalFilePrototype, 'touch_async', 'touch_finish'); +let _remoteAccessInhibited = false; + function _sessionUpdated() { if (sessionMode.isPrimary) _loadDefaultStylesheet(); @@ -121,6 +123,17 @@ function _sessionUpdated() { if (lookingGlass) lookingGlass.close(); } + + let remoteAccessController = global.backend.get_remote_access_controller(); + if (remoteAccessController) { + if (sessionMode.allowScreencast && _remoteAccessInhibited) { + remoteAccessController.uninhibit_remote_access(); + _remoteAccessInhibited = false; + } else if (!sessionMode.allowScreencast && !_remoteAccessInhibited) { + remoteAccessController.inhibit_remote_access(); + _remoteAccessInhibited = true; + } + } } function start() {